import { Body, Controller, Get, Param, Post } from '@nestjs/common'
import { RedisService } from './redis.service'
import { RedisDto } from './dto/redis.dto'
import { ApiTags } from '@nestjs/swagger'

@ApiTags('redis')
@Controller('redis')
export class RedisController {
  constructor(private readonly redisService: RedisService) {}

  @Get('get/:key')
  async redisGet(@Param('key') key: string) {
    return await this.redisService.get(key)
  }

  @Post('set')
  async redisSet(@Body() dto: RedisDto) {
    return await this.redisService.set(dto.key, dto.value)
  }
}
